Skip to content

Conversation

@jonathan343
Copy link
Contributor

This PR add the size: int parameter to the begin_list and begin_map methods in classes that implement the ShapeSerializer protocol.

This follows the interface described in the shape serializer design.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jonathan343 jonathan343 requested a review from a team as a code owner February 23, 2025 00:40
@jonathan343
Copy link
Contributor Author

Open Question
The shape serializer design defines the size parameter as a required integer value which this PR implements. I'm wondering if this parameter should be considered optional since it only seems applicable to protocols like CBOR which are serialized more efficiently with definite sizes.

@JordonPhillips
Copy link
Contributor

I'm wondering if this parameter should be considered optional since it only seems applicable to protocols like CBOR which are serialized more efficiently with definite sizes.

Callers to these methods generally don't know what concrete implementation they're calling out to, so they always have to set it. len is static time generally so it shouldn't be a performance issue

JordonPhillips
JordonPhillips previously approved these changes Feb 24, 2025
@jonathan343 jonathan343 merged commit 68252bd into smithy-lang:develop Feb 25, 2025
1 check passed
@jonathan343 jonathan343 deleted the add-size-hints branch February 25, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants